<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="root">
        <form @submit.prevent="submit">
            账号：<input type="text" v-model.lazy.trim="userInfo.account"><br><br>
            密码：<input type="password" v-model="userInfo.password"><br><br>
            年龄：<input type="number" v-model.number="userInfo.age"><br><br>
            性别：
            男<input type="radio" name="sex" v-model="userInfo.sex" value="male">
            女<input type="radio" name="sex" v-model="userInfo.sex" value="female"><br><br>
            爱好：
            学习<input type="checkbox" v-model="userInfo.hobby" value="study">
            打游戏<input type="checkbox" v-model="userInfo.hobby" value="game">
            唱歌<input type="checkbox" v-model="userInfo.hobby" value="sing">
            <br><br>
            所属小区：
            <select v-model='userInfo.address'>
                <option value="">请选择</option>
                <option value="hlg">回龙观</option>
                <option value="mld">马连点</option>
                <option value="hy">霍营</option>
            </select><br><br>
            其他信息：
            <textarea v-model.trim="userInfo.other"></textarea><br><br>
            <input type="checkbox" v-model="userInfo.agree">阅读并接受<a href="http://baidu.com">《用户协议》</a><br><br>
            <button>提交</button>
        </form>
    </div>

    <script>
        new Vue({
            el: '#root',
            data: {
                userInfo: {
                    account: '',
                    password: '',
                    age: '',
                    sex: '',
                    hobby: [],
                    address: '',
                    other: '',
                    agree: '',
                }
            },
            methods: {
                submit() {
                    console.log('submit', this.userInfo)
                }
            }
        })
    </script>
</body>
</html>